package com.weavernorth;

import org.junit.Before;
import org.junit.Test;
import weaver.conn.RecordSet;
import weaver.general.BaseBean;
import weaver.general.GCONST;
import weaver.hrm.User;

import java.net.InetAddress;
import java.net.UnknownHostException;

/**
 * @Classname Test
 * @Description TODO
 * @Version 1.0.0
 * @Date 2022/7/21 0021 16:45
 * @Created by llh
 */
public class TestAction {

    @Before
    public void before() throws Exception {
        GCONST.setServerName("ecology");
        GCONST.setRootPath("D:\\mywork\\Ecology9单元测试\\ecology\\");
        String hostname = "Unknown";
        try {
            InetAddress addr = InetAddress.getLocalHost();
            hostname = addr.getHostName();
        } catch (UnknownHostException ex) {
            System.out.println("Hostname can not be resolved");
        }
    }

    @Test
    public void test() {
        BaseBean baseBean = new BaseBean();
        /* 连接数据库 */
        RecordSet rs = new RecordSet();
        rs.executeQuery("select *  from hrmresource");
        while (rs.next()) {
            System.out.println("lastname = " + rs.getString("lastname"));
        }
        String weaver = rs.getPropValue("weaver", "ecology.url");
        baseBean.writeLog("weaver", weaver);
        User user = new User(1);
        String loginid = user.getLoginid();
        System.out.println("loginid = " + loginid);
    }
}